﻿using System.Threading.Tasks;
using JetBrains.Annotations;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;

namespace CommonManagement
{
    /// <summary>
    /// 反馈管理类
    /// </summary>
    public class FeedbackManager : DomainService
    {
        private readonly IRepository<Feedback, int> _feedbackRepository;

        public FeedbackManager(
            IRepository<Feedback, int> feedbackRepository)
        {
            _feedbackRepository = feedbackRepository;
        }

        public async Task<Feedback> CreateAsync(
            int userId,
            string appType,
            [NotNull] string title,
            [NotNull] string content)
        {
            return await _feedbackRepository.InsertAsync(
                new Feedback(
                    userId,
                    appType,
                    title,
                    content
                )
            );
        }
    }
}